package org.xyl.context;

/**
 * 上下文感知引擎 - 系统的核心组件
 * 负责提取、融合和组装多源上下文信息
 */
public class ContextEngine {
    
    private ContextExtractor contextExtractor;
    private ContextFusion contextFusion;
    private ContextAssembler contextAssembler;
    
    public ContextEngine() {
        this.contextExtractor = new ContextExtractor();
        this.contextFusion = new ContextFusion();
        this.contextAssembler = new ContextAssembler();
    }
    
    /**
     * 处理用户输入，生成增强提示
     */
    public String processQuery(String userQuery, String sessionId) {
        // 1. 提取与理解
        ContextExtractionResult extractionResult = contextExtractor.extract(userQuery, sessionId);
        
        // 2. 多源融合
        FusionResult fusionResult = contextFusion.fuse(extractionResult);
        
        // 3. 推理与组装
        return contextAssembler.assemble(fusionResult);
    }
}